﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace CanTeenShow
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        int mtInt = 0;
        int zhInt = 0;
        int cfInt = 0;
        int bqlInt = 0;
        public void MTIntClear(int Init)
        {
            try
            {
                if (Init < 1)
                {
                    MTID1.Text = "";
                    MTType1.Text = "";
                }
                else if (Init < 2)
                {
                    MTID2.Text = "";
                    MTType2.Text = "";
                }
                else if (Init < 3)
                {
                    MTID3.Text = "";
                    MTType3.Text = "";
                }
                else if (Init < 4)
                {
                    MTID4.Text = "";
                    MTType4.Text = "";
                }
                else if (Init < 5)
                {
                    MTID5.Text = "";
                    MTType5.Text = "";
                }
                else if (Init < 6)
                {
                    MTID6.Text = "";
                    MTType6.Text = "";
                }
                else if (Init < 7)
                {
                    MTID7.Text = "";
                    MTType7.Text = "";
                }
                else if (Init < 8)
                {
                    MTID8.Text = "";
                    MTType8.Text = "";
                }
                else if (Init < 9)
                {
                    MTID9.Text = "";
                    MTType9.Text = "";
                }
                else if (Init < 10)
                {
                    MTID10.Text = "";
                    MTType10.Text = "";
                }
            }
            catch (Exception)
            {
                return;
            }
        }
        public void ZHIntClear(int Init)
        {
            try
            {
                if (Init < 1)
                {
                    ZHID1.Text = "";
                    ZHType1.Text = "";
                }
                else if (Init < 2)
                {
                    ZHID2.Text = "";
                    ZHType2.Text = "";
                }
                else if (Init < 3)
                {
                    ZHID3.Text = "";
                    ZHType3.Text = "";
                }
                else if (Init < 4)
                {
                    ZHID4.Text = "";
                    ZHType4.Text = "";
                }
                else if (Init < 5)
                {
                    ZHID5.Text = "";
                    ZHType5.Text = "";
                }
                else if (Init < 6)
                {
                    ZHID6.Text = "";
                    ZHType6.Text = "";
                }
                else if (Init < 7)
                {
                    ZHID7.Text = "";
                    ZHType7.Text = "";
                }
                else if (Init < 8)
                {
                    ZHID8.Text = "";
                    ZHType8.Text = "";
                }
                else if (Init < 9)
                {
                    ZHID9.Text = "";
                    ZHType9.Text = "";
                }
                else if (Init < 10)
                {
                    ZHID10.Text = "";
                    ZHType10.Text = "";
                }
            }
            catch (Exception)
            {
                return;
            }
        }
        public void BQLIntClear(int Init)
        {
            try
            {
                if (Init < 1)
                {
                    BQLID1.Text = "";
                    BQLType1.Text = "";
                }
                else if (Init < 2)
                {
                    BQLID2.Text = "";
                    BQLType2.Text = "";
                }
                else if (Init < 3)
                {
                    BQLID3.Text = "";
                    BQLType3.Text = "";
                }
                else if (Init < 4)
                {
                    BQLID4.Text = "";
                    BQLType4.Text = "";
                }
                else if (Init < 5)
                {
                    BQLID5.Text = "";
                    BQLType5.Text = "";
                }
                else if (Init < 6)
                {
                    BQLID6.Text = "";
                    BQLType6.Text = "";
                }
                else if (Init < 7)
                {
                    BQLID7.Text = "";
                    BQLType7.Text = "";
                }
                else if (Init < 8)
                {
                    BQLID8.Text = "";
                    BQLType8.Text = "";
                }
                else if (Init < 9)
                {
                    BQLID9.Text = "";
                    BQLType9.Text = "";
                }
                else if (Init < 10)
                {
                    BQLID10.Text = "";
                    BQLType10.Text = "";
                }
            }
            catch (Exception)
            {
                return;
            }
        }
        public void CoffeeIntClear(int Init)
        {
            try
            {
                if (Init < 1)
                {
                    CFID1.Text = "";
                    CFType1.Text = "";
                }
                else if (Init < 2)
                {
                    CFID2.Text = "";
                    CFType2.Text = "";
                }
                else if (Init < 3)
                {
                    CFID3.Text = "";
                    CFType3.Text = "";
                }
                else if (Init < 4)
                {
                    CFID4.Text = "";
                    CFType4.Text = "";
                }
                else if (Init < 5)
                {
                    CFID5.Text = "";
                    CFType5.Text = "";
                }
                else if (Init < 6)
                {
                    CFID6.Text = "";
                    CFType6.Text = "";
                }
                else if (Init < 7)
                {
                    CFID7.Text = "";
                    CFType7.Text = "";
                }
                else if (Init < 8)
                {
                    CFID8.Text = "";
                    CFType8.Text = "";
                }
                else if (Init < 9)
                {
                    CFID9.Text = "";
                    CFType9.Text = "";
                }
                else if (Init < 10)
                {
                    CFID10.Text = "";
                    CFType10.Text = "";
                }
            }
            catch (Exception)
            {
                return;
            }
        }
        public void mtClear()
        {
            try
            {
                MTID1.Text = "";
                MTID2.Text = "";
                MTID3.Text = "";
                MTID4.Text = "";
                MTID5.Text = "";
                MTID6.Text = "";
                MTID7.Text = "";
                MTID8.Text = "";
                MTID9.Text = "";
                MTID10.Text = "";
                MTType1.Text = "";
                MTType2.Text = "";
                MTType3.Text = "";
                MTType4.Text = "";
                MTType5.Text = "";
                MTType6.Text = "";
                MTType7.Text = "";
                MTType8.Text = "";
                MTType9.Text = "";
                MTType10.Text = "";
            }
            catch (Exception)
            {
                return;
            }
        }
        public void zhClear()
        {
            try
            {
                ZHID1.Text = "";
                ZHID2.Text = "";
                ZHID3.Text = "";
                ZHID4.Text = "";
                ZHID5.Text = "";
                ZHID6.Text = "";
                ZHID7.Text = "";
                ZHID8.Text = "";
                ZHID9.Text = "";
                ZHID10.Text = "";
                ZHType1.Text = "";
                ZHType2.Text = "";
                ZHType3.Text = "";
                ZHType4.Text = "";
                ZHType5.Text = "";
                ZHType6.Text = "";
                ZHType7.Text = "";
                ZHType8.Text = "";
                ZHType9.Text = "";
                ZHType10.Text = "";
            }
            catch (Exception)
            {
                return;
            }
        }
        public void bqlClear()
        {
            try
            {
                BQLID1.Text = "";
                BQLID2.Text = "";
                BQLID3.Text = "";
                BQLID4.Text = "";
                BQLID5.Text = "";
                BQLID6.Text = "";
                BQLID7.Text = "";
                BQLID8.Text = "";
                BQLID9.Text = "";
                BQLID10.Text = "";
                BQLType1.Text = "";
                BQLType2.Text = "";
                BQLType3.Text = "";
                BQLType4.Text = "";
                BQLType5.Text = "";
                BQLType6.Text = "";
                BQLType7.Text = "";
                BQLType8.Text = "";
                BQLType9.Text = "";
                BQLType10.Text = "";
            }
            catch (Exception)
            {
                return;
            }
        }
        public void CFClear()
        {
            try
            {
                CFID1.Text = "";
                CFID2.Text = "";
                CFID3.Text = "";
                CFID4.Text = "";
                CFID5.Text = "";
                CFID6.Text = "";
                CFID7.Text = "";
                CFID8.Text = "";
                CFID9.Text = "";
                CFID10.Text = "";
                CFType1.Text = "";
                CFType2.Text = "";
                CFType3.Text = "";
                CFType4.Text = "";
                CFType5.Text = "";
                CFType6.Text = "";
                CFType7.Text = "";
                CFType8.Text = "";
                CFType9.Text = "";
                CFType10.Text = "";
            }
            catch (Exception)
            {
                return;
            }
        }
        public void MsgShow()
        {
            try
            {
                while (true)
                {
                    try
                    {
                        Device device = new Device();
                        string lists = JsonConvert.SerializeObject(device);
                        var data = HttpMsg.Instance.deviceOrderQueueListMsg(lists);
                        if (data != null)
                        {
                            var msglist = JsonConvert.DeserializeObject<HTTPMsg>(data);
                            if (msglist != null)
                            {
                                if (msglist.data.ToString().Length > 10)
                                {
                                    var list = JsonConvert.DeserializeObject<List<deviceOrderQueueList>>(msglist.data.ToString());
                                    if (list.Count > 0)
                                    {
                                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(delegate
                                        {
                                            bool list2 = false;
                                            foreach (var item in list)
                                            {
                                                if (item.typeList2.Count > 0)
                                                {
                                                    foreach (var item2 in item.typeList2)
                                                    {
                                                        if (mtInt < 10)
                                                        {
                                                            MTTypeShow(item2.id, mtInt, item2.goodsName, item2.status, item2.goodsOptionName, item2.price, item2.goodsPath);
                                                            mtInt++;
                                                        }
                                                        else
                                                        {
                                                            list2 = true;
                                                            break;
                                                        }
                                                    }
                                                    if (list2)
                                                    {
                                                        break;
                                                    }
                                                }
                                                else
                                                {
                                                    mtClear();
                                                }
                                            }
                                            MTIntClear(mtInt);
                                            bool list3 = false;
                                            foreach (var item in list)
                                            {
                                                if (item.typeList3.Count > 0)
                                                {
                                                    foreach (var item2 in item.typeList3)
                                                    {
                                                        if (bqlInt < 10)
                                                        {
                                                            BQLTypeShow(item2.id, bqlInt, item2.goodsName, item2.status, item2.goodsOptionName, item2.price, item2.goodsPath);
                                                            bqlInt++;
                                                        }
                                                        else
                                                        {
                                                            list3 = true;
                                                            break;
                                                        }
                                                    }
                                                    if (list3)
                                                    {
                                                        break;
                                                    }
                                                }
                                                else
                                                {
                                                    bqlClear();
                                                }
                                            }
                                            BQLIntClear(bqlInt);
                                            bool list4 = false;
                                            foreach (var item in list)
                                            {
                                                if (item.typeList4.Count > 0)
                                                {
                                                    foreach (var item2 in item.typeList4)
                                                    {
                                                        if (zhInt < 10)
                                                        {
                                                            ZHTypeShow(item2.id, zhInt, item2.goodsName, item2.status, item2.goodsOptionName, item2.price, item2.goodsPath);
                                                            zhInt++;
                                                        }
                                                        else
                                                        {
                                                            list4 = true;
                                                            break;
                                                        }
                                                    }
                                                    if (list4)
                                                    {
                                                        break;
                                                    }
                                                }
                                                else
                                                {
                                                    zhClear();
                                                }
                                            }
                                            ZHIntClear(zhInt);
                                        }));
                                    }
                                    else
                                    {
                                        this.Dispatcher.BeginInvoke(new Action(delegate
                                        {
                                            mtClear();
                                            zhClear();
                                            bqlClear();
                                        }));
                                    }
                                }
                                else
                                {
                                    this.Dispatcher.BeginInvoke(new Action(delegate
                                    {
                                        mtClear();
                                        zhClear();
                                        bqlClear();
                                    }));
                                }
                            }
                        }
                        else
                        {
                            this.Dispatcher.BeginInvoke(new Action(delegate
                            {
                                mtClear();
                                zhClear();
                                bqlClear();
                            }));
                        }
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        Device device = new Device();
                        device.deviceId = "2";
                        string lists = JsonConvert.SerializeObject(device);
                        var data = HttpMsg.Instance.deviceOrderQueueListMsgCoffee(lists);
                        if (data != null)
                        {
                            var msglist = JsonConvert.DeserializeObject<HTTPMsg>(data);
                            if (msglist != null)
                            {
                                if (msglist.data.ToString().Length > 10)
                                {
                                    var list = JsonConvert.DeserializeObject<List<deviceOrderQueueList>>(msglist.data.ToString());
                                    if (list.Count > 0)
                                    {
                                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(delegate
                                        {
                                            bool list2 = false;
                                            foreach (var item in list)
                                            {
                                                if (item.typeList2.Count > 0)
                                                {
                                                    foreach (var item2 in item.typeList2)
                                                    {
                                                        if (cfInt < 10)
                                                        {
                                                            CFTypeShow(item2.id, cfInt, item2.goodsName, item2.status, item2.goodsOptionName, item2.price, item2.goodsPath);
                                                            cfInt++;
                                                        }
                                                        else
                                                        {
                                                            list2 = true;
                                                            break;
                                                        }
                                                    }
                                                    if (list2)
                                                    {
                                                        break;
                                                    }
                                                }
                                                else
                                                {
                                                    CFClear();
                                                }
                                            }
                                            CoffeeIntClear(cfInt);
                                        }));
                                    }
                                    else
                                    {
                                        this.Dispatcher.BeginInvoke(new Action(delegate
                                        {
                                            CFClear();
                                        }));
                                    }
                                }
                                else
                                {
                                    this.Dispatcher.BeginInvoke(new Action(delegate
                                    {
                                        CFClear();
                                    }));
                                }
                            }
                        }
                        else
                        {
                            this.Dispatcher.BeginInvoke(new Action(delegate
                            {
                                CFClear();
                            }));
                        }
                    }
                    catch (Exception)
                    {
                    }
                    Thread.Sleep(2000);
                }
            }
            catch (Exception)
            {
                return;
            }
          
        }
        /// <summary>
        /// 面条状态信息显示
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="status"></param>
        /// <param name="guige"></param>
        /// <param name="price"></param>
        /// <param name="img"></param>
        public void MTTypeShow(string goodsid, int id, string name, string status, string guige, string price, string img)
        {
            try
            {
                this.Dispatcher.BeginInvoke(new Action(delegate
                {
                    if (id == 0)
                    {
                        MTID1.Text = name;
                        MTType1.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType1.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 1)
                    {
                        MTID2.Text = name;
                        MTType2.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType2.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 2)
                    {
                        MTID3.Text = name;
                        MTType3.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType3.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 3)
                    {
                        MTID4.Text = name;
                        MTType4.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType4.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 4)
                    {
                        MTID5.Text = name;
                        MTType5.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType5.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }

                    else if (id == 5)
                    {
                        MTID6.Text = name;
                        MTType6.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType6.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 6)
                    {
                        MTID7.Text = name;
                        MTType7.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType7.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 7)
                    {
                        MTID8.Text = name;
                        MTType8.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType8.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 8)
                    {
                        MTID9.Text = name;
                        MTType9.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType9.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 9)
                    {
                        MTID10.Text = name;
                        MTType10.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        MTType10.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                }));
                GC.Collect();
            }
            catch (Exception)
            {
                return;
            }
        }
        /// <summary>
        /// 炸货状态信息显示
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="status"></param>
        /// <param name="guige"></param>
        /// <param name="price"></param>
        /// <param name="img"></param>
        public void ZHTypeShow(string goodsid, int id, string name, string status, string guige, string price, string img)
        {
            try
            {
                this.Dispatcher.BeginInvoke(new Action(delegate
                {
                    if (id == 0)
                    {
                        ZHID1.Text = name;
                        ZHType1.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType1.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 1)
                    {
                        ZHID2.Text = name;
                        ZHType2.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType2.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 2)
                    {
                        ZHID3.Text = name;
                        ZHType3.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType3.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 3)
                    {
                        ZHID4.Text = name;
                        ZHType4.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType4.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 4)
                    {
                        ZHID5.Text = name;
                        ZHType5.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType5.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 5)
                    {
                        ZHID6.Text = name;
                        ZHType6.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType6.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 6)
                    {
                        ZHID7.Text = name;
                        ZHType7.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType7.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 7)
                    {
                        ZHID8.Text = name;
                        ZHType8.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType8.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 8)
                    {
                        ZHID9.Text = name;
                        ZHType9.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType9.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 9)
                    {
                        ZHID10.Text = name;
                        ZHType10.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        ZHType10.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                }));
                GC.Collect();
            }
            catch (Exception)
            {
                return;
            }
        }
        /// <summary>
        /// 炸货状态信息显示
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="status"></param>
        /// <param name="guige"></param>
        /// <param name="price"></param>
        /// <param name="img"></param>
        public void BQLTypeShow(string goodsid, int id, string name, string status, string guige, string price, string img)
        {
            try
            {
                this.Dispatcher.BeginInvoke(new Action(delegate
                {
                    if (id == 0)
                    {
                        BQLID1.Text = name;
                        BQLType1.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType1.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 1)
                    {
                        BQLID2.Text = name;
                        BQLType2.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType2.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 2)
                    {
                        BQLID3.Text = name;
                        BQLType3.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType3.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 3)
                    {
                        BQLID4.Text = name;
                        BQLType4.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType4.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 4)
                    {
                        BQLID5.Text = name;
                        BQLType5.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType5.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 5)
                    {
                        BQLID6.Text = name;
                        BQLType6.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType6.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 6)
                    {
                        BQLID7.Text = name;
                        BQLType7.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType7.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 7)
                    {
                        BQLID8.Text = name;
                        BQLType8.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType8.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 8)
                    {
                        BQLID9.Text = name;
                        BQLType9.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType9.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 9)
                    {
                        BQLID10.Text = name;
                        BQLType10.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        BQLType10.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                }));
                GC.Collect();
            }
            catch (Exception)
            {
                return;
            }
        }
        /// <summary>
        /// 炸货状态信息显示
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="status"></param>
        /// <param name="guige"></param>
        /// <param name="price"></param>
        /// <param name="img"></param>
        public void CFTypeShow(string goodsid, int id, string name, string status, string guige, string price, string img)
        {
            try
            {
                this.Dispatcher.BeginInvoke(new Action(delegate
                {
                    if (id == 0)
                    {
                        CFID1.Text = name;
                        CFType1.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType1.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 1)
                    {
                        CFID2.Text = name;
                        CFType2.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType2.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 2)
                    {
                        CFID3.Text = name;
                        CFType3.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType3.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 3)
                    {
                        CFID4.Text = name;
                        CFType4.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType4.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 4)
                    {
                        CFID5.Text = name;
                        CFType5.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType5.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 5)
                    {
                        CFID6.Text = name;
                        CFType6.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType6.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 6)
                    {
                        CFID7.Text = name;
                        CFType7.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType7.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 7)
                    {
                        CFID8.Text = name;
                        CFType8.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType8.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 8)
                    {
                        CFID9.Text = name;
                        CFType9.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType9.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                    else if (id == 9)
                    {
                        CFID10.Text = name;
                        CFType10.Text = status == "3" ? "Waiting" : status == "4" ? "Processing" : "Completed";
                        CFType10.Foreground = status == "3" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 175, 61)) : status == "4" ? new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 201, 196)) : new SolidColorBrush(System.Windows.Media.Color.FromRgb(153, 153, 153));
                    }
                }));
                GC.Collect();
            }
            catch (Exception)
            {
                return;
            }
        }
    }
}
